function Agg=Aggregation_RichVsPoor(PP,SS,QW_fzo,DistPolicy,UnitTrMat)

% DistPolicy_V=   SS.DistPolicy.V;
% DistPolicy_Vhat=SS.DistPolicy.Vhat;
% QW_fzo      =   SS.Dist_fzo.QW_fzo;
%% Preliminaries
QW          =   UnitTrMat.ReEval*QW_fzo;
QW_V        =   (1-PP.XI)*QW;
QW_Vhat     =   PP.XI*QW;

f           =   SS.DistApp.fzo.State(:,1);
ID          =   SS.DistApp.fzo.State(:,2);
N_State     =   size(ID,1);

ID_FI       =   SS.FunApp.ExoState.State(ID,2);
ID_RI       =   SS.FunApp.ExoState.State(ID,3);

FI          =   PP.ExoState.Idio_FI.Node(ID_FI);
RI          =   PP.ExoState.Idio_RI.Node(ID_RI);

Ind_dom     =   FI==0;
Ind_ext     =   ~Ind_dom;

Ind_N       =   RI==0;
Ind_H       =   ~Ind_N;

Mid_f       =   max(SS.DistApp.fzo.UnitNode{1}(cumsum(SS.Dist_fzo.Marginal_fzo.f)<0.5));
f           =   SS.DistApp.fzo.State(:,1);
Ind_rich    =   f>Mid_f;
Ind_poor    =   f<=Mid_f;
%% Aggregation
% Weighted Policies
TempList    =   {'c','l','b','fc','fp','zl','UI'};
for ii=1:length(TempList)
    vv              =   TempList{ii};
    QWQQ.V.(vv)     =   DistPolicy.V.(vv).*QW_V;
    QWQQ.Vhat.(vv)  =   DistPolicy.Vhat.(vv).*QW_Vhat;
end

QWQQ.V.f    =   f.*QW_V;
QWQQ.Vhat.f =   f.*QW_Vhat;
% Consumption (basket)
AvgC_Rich   =   ( sum(QWQQ.V.c(Ind_rich))+sum(QWQQ.Vhat.c(Ind_rich)) )/ ...
                ( sum(QW_V(Ind_rich))+sum(QW_Vhat(Ind_rich)) );
AvgC_Poor   =   ( sum(QWQQ.V.c(Ind_poor))+sum(QWQQ.Vhat.c(Ind_poor)) )/ ...
                ( sum(QW_V(Ind_poor))+sum(QW_Vhat(Ind_poor)) );

Agg         =   struct('AvgC_Rich',AvgC_Rich,'AvgC_Poor',AvgC_Poor);
